package com.imau.filter;

import javax.servlet.*;
import java.io.IOException;

//拦截器 /* 首页 登录页 注册页 css  image
//@WebFilter("/*")
public class FilterDemo2 implements Filter {
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("FilterDemo2 init...");
    }

    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //拦截请求增加功能
        System.out.println("FilterDemo2 拦截...");

        //放行

        filterChain.doFilter(servletRequest,servletResponse);

        //响应前 增加一些功能
        System.out.println("FilterDemo2 响应...");
    }

    public void destroy() {
        System.out.println("Filter destroy...");
    }
}
